<!-- meta page description: Image processing in GRASS GIS -->
<!-- meta page index: imagery -->
<h3>Image processing in general</h3>

<b>Digital numbers and physical values (reflection/radiance-at-sensor):</b>
<p>
Satellite imagery is commonly stored in Digital Numbers (DN) for 
minimizing the storage volume, i.e. the originally sampled analog 
physical value (color, temperature, etc) is stored a discrete 
representation in 8-16 bits. For example, Landsat data are stored in 
8bit values (i.e., ranging from 0 to 255); other satellite data may 
be stored in 10 or 16 bits. Having data stored in DN, it implies 
that these data are not yet the observed ground reality. Such data 
are called "at-satellite", for example the amount of energy sensed 
by the sensor of the satellite platform is encoded in 8 or more 
bits. This energy is called radiance-at-sensor. To obtain physical 
values from DNs, satellite image providers use a linear transform 
equation <tt>(y = a * x + b)</tt> to encode the radiance-at-sensor 
in 8 to 16 bits. DNs can be turned back into physical values by 
applying the reverse formula <tt>(x = (y - b) / a)</tt>.
<p>
The GRASS GIS module <a href="i.landsat.toar.html">i.landsat.toar</a>
easily transforms Landsat DN to radiance-at-sensor (top of atmosphere,
TOA). The equivalent module for ASTER data is
<a href="i.aster.toar.html">i.aster.toar</a>.
For other satellites, <a href="r.mapcalc.html">r.mapcalc</a> can 
be employed.
<p>
<b>Reflection/radiance-at-sensor and surface reflectance</b>
<p>
When radiance-at-sensor has been obtained, still the atmosphere 
influences the signal as recorded at the sensor. This atmospheric 
interaction with the sun energy reflected back into space by 
ground/vegetation/soil needs to be corrected. The need of
removing atmospheric artifacts stems from the fact that the
atmosphericic conditions are changing over time. Hence, to gain
comparability between Earth surface images taken at different
times, atmospheric need to be removed converting at-sensor values
which are top of atmosphere to surface reflectance values.
<p>
In GRASS GIS, there are two ways to apply atmospheric correction for
satellite imagery. A simple, less accurate way for Landsat is with
<a href="i.landsat.toar.html">i.landsat.toar</a>,
using the DOS correction method. The more accurate way is using 
<a href="i.atcorr.html">i.atcorr</a> (which supports many satellite 
sensors). The atmospherically corrected sensor data represent 
surface <a href="http://en.wikipedia.org/wiki/reflectance">reflectance</a>,
which ranges theoretically from 0% to 100%. Note that this level of 
data correction is the proper level of correction to calculate 
vegetation indices.
<p>
In GRASS GIS, image data are identical to <a href="rasterintro.html">raster data</a>.
However, a couple of commands are explicitly dedicated to image 
processing. The geographic boundaries of the raster/imagery file are 
described by the north, south, east, and west fields. These values 
describe the lines which bound the map at its edges. These lines do 
NOT pass through the center of the grid cells at the edge of the 
map, but along the edge of the map itself.

<p>
As a general rule in GRASS:
<ol>
<li> Raster/imagery output maps have their bounds and resolution equal
 to those of the current region.
<li> Raster/imagery input maps are automatically cropped/padded and
 rescaled (using nearest-neighbor resampling) to match the current
 region.
</ol>


<h3>Imagery import</h3>

The module <a href="r.in.gdal.html">r.in.gdal</a> offers a common
interface for many different raster and satellite image
formats. Additionally, it also offers options such as on-the-fly
location creation or extension of the default region to match the
extent of the imported raster map.  For special cases, other import
modules are available. Always the full map is imported. Imagery data
can be group (e.g. channel-wise) with <a href="i.group.html">i.group</a>.

<p>
For importing scanned maps, the user will need to create a
x,y-location, scan the map in the desired resolution and save it into
an appropriate raster format (e.g. tiff, jpeg, png, pbm) and then use
<a href="r.in.gdal.html">r.in.gdal</a> to import it. Based on
reference points the scanned map can be rectified to obtain geocoded
data.

<h3>Image processing operations</h3>

GRASS raster/imagery map processing is always performed in the current
region settings (see <a href="g.region.html">g.region</a>), i.e. the
current region extent and current raster resolution is used. If the
resolution differs from that of the input raster map(s), on-the-fly
resampling is performed (nearest neighbor resampling). If this is not
desired, the input map(s) has/have to be resampled beforehand with one
of the dedicated modules.

<h3>Geocoding of imagery data</h3>

GRASS is able to geocode raster and image data of various types:

<ul>
<li>unreferenced scanned maps by defining four corner points
 (<a href="i.group.html">i.group</a>, <a href="i.target.html">i.target</a>,
 <a href="g.gui.gcp.html">g.gui.gcp</a>, <a href="i.rectify.html">i.rectify</a>)</li>
<li>unreferenced satellite data from optical and Radar sensors by
 defining a certain number of ground control points 
 (<a href="i.group.html">i.group</a>, <a href="i.target.html">i.target</a>,
 <a href="g.gui.gcp.html">g.gui.gcp</a>, <a href="i.rectify.html">i.rectify</a>)</li>
<li>interactive graphical <a href="wxGUI.gcp.html">Ground Control Point (GCP) manager</a></li>
<li>orthophoto generation based on DEM: <a href="i.ortho.photo.html">i.ortho.photo</a></li>
<li>digital handheld camera geocoding: modified procedure for
    <a href="i.ortho.photo.html">i.ortho.photo</a></li>
</ul>


<h3>Visualizing (true) color composites</h3>

To quickly combine the first three channels to a near natural color
image, the GRASS command <a href="d.rgb.html">d.rgb</a> can be used or
the graphical GIS manager (<a href="wxGUI.html">wxGUI</a>). It assigns
each channel to a color which is then mixed while displayed. With a
bit more work of tuning the grey scales of the channels, nearly
perfect colors can be achieved. Channel histograms can be shown with
<a href="d.histogram.html">d.histogram</a>.

<h3>Calculation of vegetation indices</h3>

An example for indices derived from multispectral data is the NDVI
(normalized difference vegetation index). To study the vegetation
status with NDVI, the Red and the Near Infrared channels (NIR) are
taken as used as input for simple map algebra in the GRASS command
<a href="r.mapcalc.html">r.mapcalc</a>
(<tt>ndvi = 1.0 * (nir - red)/(nir + red)</tt>). With
<a href="r.colors.html">r.colors</a> an optimized "ndvi" color table
can be assigned afterward. Also other vegetation indices can be
generated likewise.


<h3>Calibration of thermal channel</h3>

The encoded digital numbers of a thermal infrared channel can be
transformed to degree Celsius (or other temperature units) which
represent the temperature of the observed land surface. This requires
a few algebraic steps with <a href="r.mapcalc.html">r.mapcalc</a>
which are outlined in the literature to apply gain and bias values
from the image metadata.

<h3>Image classification</h3>

Single and multispectral data can be classified to user defined land
use/land cover classes. In case of a single channel, segmentation will
be used.

GRASS supports the following methods:

<ul>
<li> Radiometric classification:
  <ul>
  <li> Unsupervised classification (<a href="i.cluster.html">i.cluster</a>,
   <a href="i.maxlik.html">i.maxlik</a>) using the Maximum Likelihood
    classification method</li>
  <li> Supervised classification (<a href="i.gensig.html">i.gensig</a>
    or <a href="g.gui.iclass.html">g.gui.iclass</a>, <a href="i.maxlik.html">i.maxlik</a>)
   using the Maximum Likelihood classification method</li>
  </ul>
<li> Combined radiometric/geometric (segmentation based) classification:
  <ul>
  <li> Supervised classification (<a href="i.gensigset.html">i.gensigset</a>,
   <a href="i.smap.html">i.smap</a>)
  </ul>
<li> Object-oriented classification:
  <ul>
  <li> Unsupervised classification (segmentation based: 
       <a href="i.segment.html">i.segment</a>)
  </ul>
</ul>
  
Kappa statistic can be calculated to validate the results
(<a href="r.kappa.html">r.kappa</a>). Covariance/correlation matrices can be
calculated with <a href="r.covar.html">r.covar</a>.

<p>
Note - signatures generated for one scene are suitable for classification
of other scenes as long as they consist of same raster bands
(band references match). This comes handy when classifying multiple scenes
from a single sensor taken in different areas or different times.

<h3>Image fusion</h3>

In case of using multispectral data, improvements of the resolution
can be gained by merging the panchromatic channel with color
channels. GRASS provides the HIS (<a href="i.rgb.his.html">i.rgb.his</a>,
<a href="i.his.rgb.html">i.his.rgb</a>) and the Brovey and PCA transform
(<a href="i.pansharpen.html">i.pansharpen</a>) methods.

<h3>Radiometric corrections</h3>

Atmospheric effects can be removed with <a href="i.atcorr.html">i.atcorr</a>.
Correction for topographic/terrain effects is offered in <a href="i.topo.corr.html">i.topo.corr</a>.
Clouds in LANDSAT data can be identified and removed with
<a href="i.landsat.acca.html">i.landsat.acca</a>.
Calibrated digital numbers of LANDSAT and ASTER imagery may be converted to
top-of-atmosphere radiance or reflectance and temperature (<a href="i.aster.toar.html">i.aster.toar</a>,
<a href="i.landsat.toar.html">i.landsat.toar</a>).

<h3>Time series processing</h3>

GRASS also offers support for time series processing (<a
href="r.series.html">r.series</a>). Statistics can be derived from a
set of coregistered input maps such as multitemporal satellite
data. The common univariate statistics and also linear regression can
be calculated.

<h3>Evapotranspiration modeling</h3>

In GRASS, several types of evapotranspiration (ET) modeling methods
are available:

<ul>
<li> Reference ET: Hargreaves (<a href="i.evapo.mh.html">i.evapo.mh</a>),
                   Penman-Monteith (<a href="i.evapo.pm.html">i.evapo.pm</a>);</li>
<li> Potential ET: Priestley-Taylor (<a href="i.evapo.pt.html">i.evapo.pt</a>);</li>
<li> Actual ET: <a href="i.evapo.time.html">i.evapo.time</a>.</li>
</ul>

Evaporative fraction: <a href="i.eb.evapfr.html">i.eb.evapfr</a>,
<a href="i.eb.hsebal01.html">i.eb.hsebal01</a>.

<h3>Energy balance</h3>

Emissivity can be calculated with <a href="i.emissivity.html">i.emissivity</a>.

Several modules support the calculation of the energy balance:
<ul>
<li> Actual evapotranspiration for diurnal period  (<a href="i.eb.eta.html">i.eb.eta</a>);</li>
<li> Evaporative fraction and root zone soil moisture (<a href="i.eb.evapfr.html">i.eb.evapfr</a>);</li>
<li> Sensible heat flux iteration (<a href="i.eb.hsebal01.html">i.eb.hsebal01</a>);</li>
<li> Net radiation approximation (<a href="i.eb.netrad.html">i.eb.netrad</a>);</li>
<li> Soil heat flux approximation (<a href="i.eb.soilheatflux.html">i.eb.soilheatflux</a>).</li>
</ul>

<h3>See also</h3>

<ul>
<li> GRASS GIS Wiki page: <a href="https://grasswiki.osgeo.org/wiki/Image_processing">Image processing</a></li>
<li>The GRASS 4 
    <em><a href="https://grass.osgeo.org/gdp/imagery/grass4_image_processing.pdf">Image
     Processing manual</a></em></li>
  <li><a href="rasterintro.html">Introduction into raster data processing</a></li>
  <li><a href="raster3dintro.html">Introduction into 3D raster data (voxel) processing</a></li>
  <li><a href="vectorintro.html">Introduction into vector data processing</a></li>
  <li><a href="temporalintro.html">Introduction into temporal data processing</a></li>
  <li><a href="databaseintro.html">Database management</a></li>
  <li><a href="projectionintro.html">Projections and spatial transformations</a></li>
</ul>
